﻿using Daemon.Common.Auth;
using Daemon.Common.Cache;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Net;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Daemon.Common;
using Microsoft.AspNetCore.Mvc.Filters;

namespace Daemon.Common.Handlers
{
    public class PermissionHandler : AuthorizationHandler<PermissionRequirement>
    {
        public IAuthenticationSchemeProvider Schemes;
        readonly IDaemonDistributedCache _cache;
        /// <summary>
        /// 构造函数注入
        /// </summary>
        public PermissionHandler(IAuthenticationSchemeProvider schemes, IDaemonDistributedCache cache)
        {
            Schemes = schemes;
            _cache = cache;
        }

        protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, PermissionRequirement requirement)
        {
            context.Succeed(requirement);
          
        }
    }
}
